#include<bits/stdc++.h>
#define db double 
using namespace std;
inline int read(){
	int x=0;bool f=0;char ch=getchar();
	while(ch<'0'||ch>'9')f^=(ch=='-'),ch=getchar();
	while('0'<=ch&&ch<='9')x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
bool stt;
const db inf=1e9;
int n,m;
db f[2][505][505];
struct node{
	int a,b;
}p[505];
inline bool cmp(node a,node b){
	if(a.b==b.b)return a.a<b.a;
	return (a.b==-1?1e9+7:a.b)<(b.b==-1?1e9+7:b.b);
}
inline bool cmp1(node a,node b){
	return a.a<b.a;
}
bool enn;
inline void solve(){
	int cnt=1;
	db res=0;
	for(int i=1;i<=m;i++){
		res+=p[i].a/1.0/cnt;
		cnt+=(p[i].b!=-1);
	}
	printf("%.7lf\n",res);
}
db g[2][505];
inline void solve1(){
	db res=inf;
	for(int l=0;l<=m;l++){
		for(int j=0;j<=n+1;j++)g[0][j]=g[1][j]=inf;
		g[0][0]=0;
		for(int i=1;i<=n;i++){
			for(int j=0;j<=min(l,min(i,m));j++){
				g[i&1][j]=g[i&1^1][j]+p[i].a/1.0/(l+1);
				if(j>0&&p[i].b!=-1)g[i&1][j]=min(g[i&1][j],g[i&1^1][j-1]+p[i].b/1.0/j);
				if(i==n&&j==l)res=min(res,g[i&1][j]);
			}
		}
	}
	printf("%.7lf\n",res);
}
inline void solve2(){
	db ans=0,res=0;sort(p+1,p+1+n,cmp1);
	for(int i=1;i<=m;i++)ans+=p[i].a;
	sort(p+1,p+1+n,cmp);
	for(int i=1;i<=m;i++){
		if(p[i].b>-1){
			res+=p[i].b/i;db tmp=0;
			for(int j=i+1;j+i<=m;j++)tmp+=p[i].a/1.0/(i+1);
			ans=min(ans,res+tmp);
		}else break;
	}printf("%.7lf\n",ans);
}
signed main(){
	freopen("talk.in","r",stdin);
	freopen("talk.out","w",stdout);
	n=read();m=read();
	int sub11=1,sub22=1;
	for(int i=1;i<=n;i++){
		p[i]={read(),read()};
		sub11&=(p[i].b==-1);
		sub22&=(p[i].b==-1||p[i].a==p[i].b);
	}sort(p+1,p+1+n,cmp);
	if(sub11)solve(),exit(0);
	if(n==m)solve1(),exit(0);
	if(sub22)solve2(),exit(0);
	if(m<=250){
		db res=inf;
		for(int l=0;l<=m;l++){
			for(int j=0;j<=n+1;j++)
				for(int k=0;k<=n+1;k++)f[0][j][k]=f[1][j][k]=inf;
			f[0][0][0]=0;
			for(int i=1;i<=n;i++){
				for(int j=0;j<=min(l,min(i,m));j++)
					for(int k=0;k+j<=min(i,m);k++){
						f[i&1][j][k]=f[i&1^1][j][k];
						if(j>0&&p[i].b!=-1)f[i&1][j][k]=min(f[i&1][j][k],f[i&1^1][j-1][k]+p[i].b/1.0/j);
						if(k>0)f[i&1][j][k]=min(f[i&1][j][k],f[i&1^1][j][k-1]+p[i].a/1.0/(l+1));
						if(k+j==m&&j==l)res=min(res,f[i&1][j][k]);
	//					printf("f[%d] [%d][%d][%d]=%.6lf\n",l,i,j,k,f[i][j][k]);
					}
			}
		}
		printf("%.7lf\n",res);
		return 0;
	}
	db res=inf;
	for(int l=max(1,n/2-50);l<=min(n,n/2+53);l++){
		for(int j=0;j<=n+1;j++)
			for(int k=0;k<=n+1;k++)f[0][j][k]=f[1][j][k]=inf;
		f[0][0][0]=0;
		for(int i=1;i<=n;i++){
			for(int j=0;j<=min(l,min(i,m));j++)
				for(int k=0;k+j<=min(i,m);k++){
					f[i&1][j][k]=f[i&1^1][j][k];
					if(j>0&&p[i].b!=-1)f[i&1][j][k]=min(f[i&1][j][k],f[i&1^1][j-1][k]+p[i].b/1.0/j);
					if(k>0)f[i&1][j][k]=min(f[i&1][j][k],f[i&1^1][j][k-1]+p[i].a/1.0/(l+1));
					if(k+j==m&&j==l)res=min(res,f[i&1][j][k]);
//					printf("f[%d] [%d][%d][%d]=%.6lf\n",l,i,j,k,f[i][j][k]);
				}
		}
	}
	printf("%.7lf\n",res);
	cerr<<(&stt-&enn)/1024.0/1024.0<<'\n';
	return 0;
}
/*
 7
 5
 28 -1
 11 -1
 20 -1
 19 -1
 31 31
 25 -1
 1145 1145
*/
